package com.wzw.expression.record.expression;

import com.wzw.expression.expression.operation.Operation;
import com.wzw.expression.record.annotations.IRecord;
import com.wzw.expression.record.interceptors.IRecordInterceptor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @author Wangzhiwen
 */
@Data
@Builder
@EqualsAndHashCode
public class IRecordOperation implements Operation {
    private String name;

    private String serial;

    private String module;

    private String submodule;

    private String content;

    private String extra;

    private Boolean ignoreParams;

    private Class<? extends IRecordInterceptor> interceptorClass;

    public static IRecordOperation annotationToThis(IRecord record, String name) {
        return IRecordOperation.builder()
                .name(name)
                .serial(record.serial())
                .module(record.module())
                .submodule(record.submodule())
                .content(record.content())
                .extra(record.extra())
                .ignoreParams(record.ignoreParams())
                .interceptorClass(record.interceptor())
                .build();
    }

}
